﻿seajs.config({
    base: './js/',
    alias: {
        'labjs': 'lib/LAB.min',
        'css': '../style/'
    }
});

define(function (require) {
    require('labjs');

    function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "[\\?&]" + name + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.href);
        if (results == null)
            return "";
        else
            return decodeURIComponent(results[1].replace(/\+/g, " "));
    }

    // 载入基础lib
    $LAB.script('js/lib/jquery-1.6.1.min.js').wait()
        .script('js/lib/jquery.iframe.js').wait()
        .script('js/lib/jquery.ba-postmessage.js')
        .wait(function () {
            //The Page logic
            var url = getParameterByName('url');
            $("iframe").src(url, function (iframe, duration) {
                $("#loading").hide();
                $("#content").fadeIn();
                window.document.title = $("iframe")[0].document.title;
            });
        });
});
